(function () {
  'use strict';
  var addNode = function (node) {
    node.isOpen = true;
    node.children.push({
      name: 'child node',
      parent: node,
      isParent: true,
      children: [],
      buttons: [
        {
          title: 'Add',
          icon: 'icon icon-plus',
          btnClass: 'label label-info',
          click: addNode
        }, {
          title: 'Delete',
          icon: 'icon icon-trash',
          btnClass: 'label label-danger',
          click: function (node) {
          }
        }
      ]
    });
  };
  new Vue({
    el: '#demo',
    data: {
      title: 'Vue Tree Demo',
      option: {
        root: {
          name: 'Root Node',
          isParent: true,
          isOpen: true,
          openedIcon: 'fa fa-folder-open-o',
          closedIcon: 'fa fa-folder-o',
          children: [
            {
              name: 'Level1 has children',
              icon: 'fa fa-folder',
              openedIcon: 'fa fa-folder-open',
              isOpen: false,
              isParent: true,
              children: [
                {
                  name: 'level2 - 1',
                  icon: 'icon-chevron-right'
                },
                {
                  name: 'level2 - 2',
                  icon: 'icon-chevron-right'
                },
                {
                  name: 'level2 - 3',
                  icon: 'icon-chevron-right'
                }
              ]
            }
          ]
        }
      }
    }
  });
})();
